package com.gxa.admin.exception;

import com.gxa.core.result.Result;
import com.gxa.core.result.ResultUtils;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author lch
 * @date 2024/3/22 21:39
 * @description 全局异常
 **/
@ControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(CustomException.class)
    @ResponseBody
    public Result custom(CustomException exception){

        return ResultUtils.buildFail(exception.getMessage());
    }


}
